package cn.tedu.property_management_system.controller;


import cn.tedu.property_management_system.service.IHomeService;
import cn.tedu.property_management_system.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/home")
public class HomeController {
    @Autowired
    private IHomeService service;

    @GetMapping("/building/list")
    public JsonResult<List<Integer>> getBuildings(){
        List<Integer> list=service.getBuilding();
        log.debug(list+"-----------------------------------------------------------");
        return JsonResult.OK(list);
    }
    @GetMapping("/building/value")
    public JsonResult<Integer> getBuilding(){
        Integer integer=service.getBuildings();
        return JsonResult.OK(integer);
    }
    @GetMapping("/house/list")
    public JsonResult<List<Integer>> gethouses(){
        List<Integer> list=service.getHouse();
        return JsonResult.OK(list);
    }
    @GetMapping("/house/value")
    public JsonResult<Integer> gethouse(){
        Integer integer=service.getHouses();
        return JsonResult.OK(integer);
    }
    @GetMapping("/owner/list")
    public JsonResult<List<Integer>> getowners(){
        List<Integer> list=service.getOwner();
        return JsonResult.OK(list);
    }
    @GetMapping("/owner/value")
    public JsonResult<Integer> getowner(){
        Integer integer=service.getOwners();
        return JsonResult.OK(integer);
    }
    @GetMapping("/meter/list")
    public JsonResult<List<Integer>> getmeters(){
        List<Integer> list=service.getOwner();
        return JsonResult.OK(list);
    }
    @GetMapping("/meter/value")
    public JsonResult<Integer> getmeter(){
        Integer integer=service.getMeters();
        return JsonResult.OK(integer);
    }
    @GetMapping("/parking/list")
    public JsonResult<List<Integer>> getparkings(){
        List<Integer> list=service.getParking();
        return JsonResult.OK(list);
    }
    @GetMapping("/parking/value")
    public JsonResult<Integer> getparking(){
        Integer integer=service.getParkings();
        return JsonResult.OK(integer);
    }



    @GetMapping("/car")
    public JsonResult<Integer> getCart(){
        Integer integer=service.getCar();
        return JsonResult.OK(integer);
    }

    @GetMapping("/property")
    public JsonResult<Integer> getProperty(){
        Integer integer=service.getProperty();
        return JsonResult.OK(integer);
    }

    @GetMapping("/complaint")
    public JsonResult<Integer> getComplaint(){
        Integer integer=service.getComplaint();
        return JsonResult.OK(integer);
    }

    @GetMapping("/repair")
    public JsonResult<Integer>  getRepair(){
        Integer integer=service.getRepair();
        return JsonResult.OK(integer);
    }

}
